package com.dogegg.lbblog.intercept;

import org.springframework.aop.support.StaticMethodMatcherPointcut;

import java.lang.reflect.Method;

public class LogRecordPointCut extends StaticMethodMatcherPointcut {

    private final LogRecordOperationSource logRecordOperationSource;

    public LogRecordPointCut(LogRecordOperationSource logRecordOperationSource) {
        this.logRecordOperationSource = logRecordOperationSource;
    }

    @Override
    public boolean matches(Method method, Class<?> targetClass) {
        LogRecordOperation cachedOperation = logRecordOperationSource.getCachedOperation(method, targetClass, false);
        return cachedOperation  != null ;
    }
}
